import { get,put,post, } from '../utils/request'

// 首先添加headers常量定义 - 移到文件顶部
const headers = {
  'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
}

export const tagList = (params) => {
  return get('/basic/tagLibrary/info/user/tags', params)
}

export const contentTagList = (params) => {
  return get('/basic/tagLibrary/info/article/tags', params)
}

// 完善根据ID获取标签的函数
export const getTagById = (params) => {
  return get('/basic/tagLibrary/info/tag/detail/{id}', params)
}

// 获取所有标签
export const getAllTags = (params) => {
  return post('/basic/tagLibrary/info/tag/all', params)
}

// 新增标签
export const addTag = (data) => {
  return post('/basic/tagLibrary/info/tag/add', data, { headers })
}

// 更新标签
export const updateTag = (data) => {
  return post('/basic/tagLibrary/info/tag/update', data)
}

// 更新标签状态
export const updateTagStatus = (id, status) => {
  return post('/basic/tagLibrary/info/tag/status', { id, status }, { headers })
}

// 删除标签（修改为与PrivilegeAccount一致的模式）
export const deleteTag = (data) => {
  return post('/basic/tagLibrary/info/tag/delete', data, { headers })
}

// 根据父标签ID获取子标签
export const getChildTagsByParentId = (params) => {
  return get('/basic/tagLibrary/info/tag/children/{parentId}', params)
}